﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Collections;
using System.Data;
using CE.Database;

/// <summary>
/// Summary description for CCSelectedCardsDB
/// </summary>
/// 
namespace CE.CreditCard
{
    public class CCSelectedCardsDB
    {
        public CCSelectedCardsDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(CCSelectedCards ccselectedcard)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocCCApplicantSelectedCardsInsertSingleItem";

            SortedList _sPara = new SortedList();

            _sPara.Add("@CCSelectedListId", ccselectedcard.CCSelectedListId);
            _sPara.Add("@CCCARId", ccselectedcard.CCARId);
            _sPara.Add("@RefCEUserId", ccselectedcard.RefCEUserId);
            _sPara.Add("@SelectCardId1", ccselectedcard.SelectedCardId1);
            _sPara.Add("@SelectCardId2", ccselectedcard.SelectedCardId2);
            _sPara.Add("@SelectCardId3", ccselectedcard.SelectedCardId3);
            _sPara.Add("@SelectCardId4", ccselectedcard.SelectedCardId4);
            _sPara.Add("@SelectCardId5", ccselectedcard.SelectedCardId5);
            _sPara.Add("@SelectCardId6", ccselectedcard.SelectedCardId6);
            _sPara.Add("@SelectCardId7", ccselectedcard.SelectedCardId7);
            _sPara.Add("@SelectCardId8", ccselectedcard.SelectedCardId8);
            _sPara.Add("@SelectCardId9", ccselectedcard.SelectedCardId9);
            _sPara.Add("@SelectCardId10", ccselectedcard.SelectedCardId10);
            _sPara.Add("@SelectCardId11", ccselectedcard.SelectedCardId11);
            _sPara.Add("@SelectCardId12", ccselectedcard.SelectedCardId12);
            _sPara.Add("@SelectCardId13", ccselectedcard.SelectedCardId13);
            _sPara.Add("@SelectCardId14", ccselectedcard.SelectedCardId14);
            _sPara.Add("@SelectCardId15", ccselectedcard.SelectedCardId15);
            _sPara.Add("@SelectCardId16", ccselectedcard.SelectedCardId16);
            _sPara.Add("@SelectCardId17", ccselectedcard.SelectedCardId17);
            _sPara.Add("@SelectCardId18", ccselectedcard.SelectedCardId18);
            _sPara.Add("@SelectCardId19", ccselectedcard.SelectedCardId19);
            _sPara.Add("@SelectCardId20", ccselectedcard.SelectedCardId20);
            _sPara.Add("@ViewedDetailId", ccselectedcard.ViewedDetailId);
            _sPara.Add("@Status", ccselectedcard.CCStatus == true ? 1 : 0);
            _sPara.Add("@Info1", ccselectedcard.CCInfo1);
            _sPara.Add("@Info2", ccselectedcard.CCInfo2);
            _sPara.Add("@Info3", ccselectedcard.CCInfo3);
            _sPara.Add("@Info4", ccselectedcard.CCInfo4);
            _sPara.Add("@Info5", ccselectedcard.CCInfo5);

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public void Delete(CCSelectedCards ccselectedcard)
        {
            MyDatabase _db = new MyDatabase();
            string _spName = "sprocCCApplicantSelectedCardsDeleteItem";
            SortedList _sPara = new SortedList();
            _sPara.Add("@CCCARId", ccselectedcard.CCARId);
            _db.ExecuteSP(_spName, _sPara);
        }


        public DataTable GetCCSelectedCardImageList(Int64 CCCARId)
        {
            DataTable _ccselectedcardimage = null;
            MyDatabase _db = new MyDatabase();
            string _spName = "sprocCCSelectedCardsImageItemList";

            SortedList _spara = new SortedList();
            _spara.Add("@CCCARId", CCCARId);

            using (DataTable _dt = _db.GetDataTableBySP(_spName, _spara))
            {
                if (_dt != null && _dt.Rows.Count > 0)
                {
                    _ccselectedcardimage = _dt;
                }
            }
            return _ccselectedcardimage;
        }

    }
}
